Namespace B1Assistant
    Public Class Others

        Public Shared Sub GetB1ApplicationMenusConstString(ByVal Path As String)
            Dim MeuUID As String
            Dim MeuStr As String
            Dim wt As IO.StreamWriter
            Dim xmldoc As New Xml.XmlDocument
            Dim MenuList As Xml.XmlNodeList
            Dim MenuNode As Xml.XmlNode
            Try
                wt = New IO.StreamWriter(Path)
                xmldoc.LoadXml(SAPBoAddon.B1Addon.B1Addon.SBOApp.Menus.GetAsXML)
                MenuList = xmldoc.GetElementsByTagName("Menu")
                For Each MenuNode In MenuList
                    MeuUID = MenuNode.Attributes.ItemOf("UniqueID").Value
                    MeuStr = MenuNode.Attributes.ItemOf("String").Value
                    MeuStr = MeuStr.Replace(" ", "_").Replace("&", "").Replace(".", "").Replace("-", "_").Replace(":", "").Replace("/", "").Replace("(", "").Replace(")", "").Replace(",", "").Replace("'", "").Replace("+", "").Replace("?", "")
                    If MeuUID <> "0" And MeuUID <> "" And MeuStr <> "" Then
                        With wt
                            .WriteLine("''' <summary>")
                            .WriteLine("''' UID=" & MeuUID)
                            .WriteLine("''' </summary>")
                            .WriteLine("''' <remarks></remarks>")
                            .WriteLine(" Public Const sys_%1 = ""%0""".Replace("%0", MeuUID).Replace("%1", MeuStr))
                            .WriteLine()
                        End With
                    End If
                Next
                wt.Close()
            Catch ex As Exception
                Throw ex
            End Try
        End Sub
    End Class
End Namespace

